import 'package:flutter/material.dart';
import 'package:flutter02/res/list_data.dart';
import 'package:intl/intl.dart';

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    // final size = MediaQuery.of(context).size;
    NumberFormat format = NumberFormat("0000");
    return ListView.builder(
        padding: const EdgeInsets.only(bottom: 50),
        itemCount: listData.length,
        itemBuilder: (context, index) {
          return Card(
            elevation: 20,
            margin: const EdgeInsets.all(5),
            // color: Colors.black12,
            shape:
                RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
            child: Column(
              children: [
                ListTile(
                    title: Text(
                      "$index.${listData[index]['title']}",
                      style: const TextStyle(fontSize: 28),
                      maxLines: 1,
                      overflow: TextOverflow.ellipsis,
                    ),
                    subtitle: Text(listData[index]['author'])),
                const Divider(),
                ListTile(
                  title: Text("电话：1762103${format.format(index)}"),
                ),
                ListTile(
                  title: Text("地址：山东省临沂市兰山区金雀山路$index号"),
                )
              ],
            ),
          );
          // return ListTile(
          //   leading: SizedBox(
          //     width: 100,
          //     height: 100,
          //     child: Image.network(
          //       listData[index]['imageUrl'],
          //       fit: BoxFit.cover,
          //     ),
          //   ),
          //   title: Text("$index.${listData[index]['title']}"),
          //   subtitle: Text(listData[index]['author']),
          // );
        });
  }
}
